<template>
  <div>
    <!-- 面包屑 -->
    <elBread />
    <!-- 添加按钮 -->
    <el-button type="primary" style="margin-top: 10px" @click="addDiolog">添加</el-button>
    <!-- 列表组件 -->
    <v-list @edit="edit" />
    <!-- 弹框 -->
    <v-Dialog :isShow="isShow" :isAdd="isAdd" @cancel="cancel" ref="diaRef" />
  </div>
</template>

<script lang="ts" setup>
import vList from "./list.vue";
import vDialog from "./dialog.vue";
import { ref } from "vue";

// 弹框编辑
let isShow = ref(false);
// 弹框添加
let isAdd = ref(true);

// 添加按钮
const addDiolog = () => {
  isShow.value = true;
  isAdd.value = true;
};

// 取消
const cancel = () => {
  isShow.value = false;
};

// 编辑
const diaRef = ref<any>(null);
const edit = (id: number) => {
  // console.log(e);
  isAdd.value = false;
  isShow.value = true;
  diaRef.value.lookup(id);
};
</script>

<style lang="less" scoped></style>
